#ifndef APPLICATION_H_H_H_H_
#define APPLICATION_H_H_H_H_
#include <QPixmap>
#include <string>
#include <vector>

#include "Application_App.h"
class Document_Gui;
class Document_App;
class CommandManager;
struct ApplicationP;

class MenuItem;
class ViewWindow;
class BaseView;

 namespace Gui
 {
   class ViewProvider;
 }
class Application
{
public:
	Application(void);
	~Application(void);

public:

	boost::signal<void(const Document_Gui&)> signalNewDocument;
	boost::signal<void(const Gui::ViewProvider&)> signalNewObject;

	boost::signal<void(const ViewWindow*)> signalActivateView;

	CommandManager& commandMananger(void);
	static Application* Instance();

	Document_Gui* activeDocument(void) const;

	static void initTypes(void);
	static void runApplication();
	static void init_resources();
    static void initApplication();
	void createStandardOperations();

	void viewActivated(ViewWindow* pcView);
	void setActiveDocument(Document_Gui* pcDocument);

	bool activateWorkbench(const char* name);

	void setupContextMenu(const char* recipient,MenuItem* items)const;

	void detachView(BaseView* pcView);
	void attachView(BaseView* pcView);

	void importEntity();

	Document_Gui* getDocument(const char* name)const;
	Document_Gui* getDocument(const Document_App* pDoc)const;

	void save();




public:
	void tryClose(QCloseEvent* e);

protected:
	void slotNewDocument(const Document_App&);
	void slotNewObject(const Gui::ViewProvider& vp);


private:
	struct ApplicationP* d;
	static Application* _instance;
};
#endif